package _05练习_排序出师表;

import java.io.*;
import java.util.Comparator;
import java.util.Set;
import java.util.TreeMap;

public class Demo {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new FileReader("D:\\黑马java培训班\\资料\\内网通下载文件\\教师端\\出师表.txt"));
        BufferedWriter bw = new BufferedWriter(new FileWriter("day11\\abd\\出师表.txt"));
        TreeMap<Integer,String> treeMap = new TreeMap<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o1 - o2;
            }
        });
        String s;
        while ((s=br.readLine())!=null){
            //System.out.println(s);
            String[] split = s.split("\\.");
            treeMap.put(Integer.parseInt(split[0]),split[1]);
        }
        Set<Integer> set = treeMap.keySet();
        for (Integer integer : set) {
            bw.write(treeMap.get(integer));
            bw.newLine();
        }


        bw.close();
        br.close();
    }
}
